pattern tutorial